Passed
Pull Request — master (#37)
by
unknown
03:48
created

tooltip.ts ➔ createTooltip   A

Complexity

Conditions 1

Size

Total Lines 12
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 12
rs 9.8
c 0
b 0
f 0
cc 1
1
import { NodeSelection } from '../../components/types';
2
import { ElementColors, TextColors } from '../../utils/AppConsts';
3
import { selectTooltip } from '../../utils/helpers/Selectors';
4
5
export function createTooltip(svgContainer: NodeSelection<SVGGElement>) {
6
    const tooltipElement = svgContainer
7
        .append('g')
8
        .attr('id', 'tooltip')
9
        .style('opacity', 0);
10
    tooltipElement
11
        .append('rect')
12
        .attr('fill', ElementColors.BUTTON)
13
        .attr('rx', 5)
14
        .attr('ry', 5);
15
    tooltipElement.append('text').attr('fill', TextColors.HIGHLIGHTED);
16
}
17
18
export function showTooltip() {
19
    selectTooltip().attr('visibility', 'visible');
20
}
21
22
export function hideTooltip() {
23
    selectTooltip().attr('visibility', 'hidden');
24
}
25